<template>
<div>
  <h1>写小说</h1>

  <p>小说名<input type="text" v-model="form.name"></p>

  内容：<p><textarea name="" id="" cols="20" rows="10" v-model="form.text"></textarea></p>
  <van-button @click="add">提交</van-button>

</div>
</template>

<script>
import maxios from "../../http/axios";

export default {
  name: "xiaoshuo",
  data(){
    return{
      form:{user:localStorage.getItem('userid')}
    }
  },
  methods:{
    add(){
      maxios('http://127.0.0.1:8000/users/Xiaoshuo/','post',this.form)
      .then(i=>{
        if (i.data.code ==200){
          alert('提交成功')
        }
        else {
          alert('提交失败，请重试')
        }
      })
    }
  },
  mounted() {
  }
}
</script>

<style scoped>

</style>